#include "begin.h"
#include "ui_begin.h"
#include <QApplication>

Begin::Begin(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Begin)
{
    ui->setupUi(this);
    this->setWindowFlags(Qt::Window);

    //设置背景图片
    QPalette palette = this->palette();
    palette.setBrush(this->backgroundRole(),QBrush(QPixmap(":/resources/road.jpg")));
    this->setPalette(palette);
}

Begin::~Begin()
{
    delete ui;
}

/**
 * @brief 退出
 *
 */
void Begin::on_pushButton_5_clicked()
{
    QSqlDatabase db = QSqlDatabase::database("my.db");
    db.close();

    qApp->quit();
}

/**
 * @brief 参数设置
 *
 */
void Begin::on_pushButton_2_clicked()
{
    this->hide();
    emit enterParam();
}

/**
 * @brief 音乐设置
 *
 */
void Begin::on_pushButton_3_clicked()
{
    this->hide();
    emit enterMusic();
}

/**
 * @brief 排行榜
 *
 */
void Begin::on_pushButton_4_clicked()
{
    this->hide();
    emit enterRank();
}

/**
 * @brief 开始游戏
 *
 */
void Begin::on_pushButton_clicked()
{
    this->hide();
    emit enterGame();
}
